<?php
$client = new swoole_client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_ASYNC);

//注册连接成功回调
$client->on('connect', function($cli) {
    $cli->send("FIND*3922267662*");
});

//注册连接失败回调
$client->on('error', function($cli) {
    $cli->send("connect failed\n");
});

//注册数据接受回调
$client->on('receive', function($cli, $data) {
    $cli->close(true);
});

//注册连接关闭回调
$client->on('close', function($cli) {
    echo "closed\n";
});

//发起连接
$client->connect('127.0.0.1', 9501, 0.5);